package gupaoedu.threadloadSingleton;

/**
 * gupaoedu.threadloadSingleton
 * linwenjie
 * 2019-06-20
 */
public class ThreadLoadSingletonTest {
    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
        System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
        System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
        System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());


        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
                System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
                System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());

            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
                System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());
                System.out.println(Thread.currentThread().getName()+":" +ThreadLoadSingleton.getInstance());

            }
        });

        t1.start();
        t2.start();
    }
}
